package cn.pugle.base.annotation;

/**
 * Created by tzp on 7/13/16.<br>
 */
public class Parent {
    public Parent() {
        System.out.println("parent constructor");
    }

    static String staticVar = "parent's staticVar";
    String var = "parent's var";
    public String parentGet(){return var;}
    public String parentStaticGet(){return staticVar;}
    public String get(){return var;}
    public String staticGet(){return staticVar;}
    public String superGet(){return var;}
    public String superStaticGet(){return staticVar;}
}
class Son extends Parent {
    public Son() {
        System.out.println("son constructor");
    }

    static String staticVar = "son's staticVar";
    String var = "son's var";
    public String sonGet(){return var;}
    public String sonStaticGet(){return staticVar;}
    public String get(){return var;}
    public String staticGet(){return staticVar;}
//    public String superGet(){return super.superGet();}
    public String superStaticGet(){return super.superStaticGet();}

    public static void main(String[] args) {
        Parent ps = new Son();
        Son ss = new Son();
        System.out.println(ss.var);//son's var
        System.out.println(ps.var);//parent's var. 如果parent没有var这里报错.
        System.out.println(ps.get());
        System.out.println(ps.staticGet());
        System.out.println(ps.superGet());
        System.out.println(ps.superStaticGet());
    }
}
